﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Collections;
using System.Text;
using BLL;

namespace TaoBaoProject.UserHandler
{
  /// <summary>
  /// Summary description for GetUserHandler
  /// </summary>
  public class GetUserHandler : IHttpHandler
  {

    public void ProcessRequest(HttpContext context)
    {
      context.Response.ContentType = "text/plain";

      StringBuilder sbRet = new StringBuilder();
      DataTable dt = UserBLL.GetAllUser();
      DataRow dr = dt.NewRow();
      dr["UserID"] = "10000";
      dr["UserName"] = "选择用户";
      dt.Rows.InsertAt(dr, 0);

      dt.Columns.Add("id");
      for (int i = 1; i < dt.Rows.Count; i++)
      {
        dt.Rows[i]["id"] = dt.Rows[i]["UserId"];
      }

      sbRet.Append(Common.Utility.GetJsonString(dt));

      context.Response.Write(sbRet);
    }

    public bool IsReusable
    {
      get
      {
        return false;
      }
    }
  }
}